<div class="findtrs" >
	<form action="" class="layui-inline layui-form" method="post" style="width: 100%;">
		<div class="ftitle">
			<div class="lt">
				<h2>绑定支付宝|微信</h2>
			</div>
		</div>
		<div class="fremittanpred fbai" >
			<div class="list">
				<ul>
					<li style="min-width: 450px;font-size: 20px;">
						<label>支付宝(<span style="color: red">{if $list.alipay_name != '***'}已绑定{else}未绑定{/if}</span>) <i>*</i></label>
						{if $list.alipay_name != '***'}
						<input type="text" class="info" value="{$list.alipay_name}" readonly maxlength="100" class="txt">
						{else}
						<input type="text" class="info" name="alipay_name" id="alipay_name" lay-verify="required" lay-verType="tips" maxlength="100" class="txt" placeholder="请填写支付宝账号">
						{/if}
						<br />
						<label>微信(<span style="color: red">{if $list.we_chat != '***'}已绑定{else}未绑定{/if}</span>) <i>*</i></label>
						{if $list.we_chat != '***'}
						<input type="text" class="info" value="{$list.we_chat}" readonly maxlength="100" class="txt">
						{else}
						<input type="text" class="info" name="we_chat" id="we_chat" lay-verify="required" lay-verType="tips" maxlength="100" class="txt" placeholder="请填写微信">
						{/if}
						<br />
						<label>验证码 <i>*</i></label>
						<div class="layui-form-item" id="captcha_div">
							<div class="layui-col-xs7">
								<input type="text" style="border-radius: 7px" name="captcha" id="captcha_ipt" value=""  lay-verType="tips"
									   lay-verify="required" placeholder="{:lang('请输入验证码')}" class="layui-input" maxlength="4">
							</div>
							<div class="layui-col-xs5">
								<div style="margin-left: 10px;">
									<img src="{:url('verify/index')}" id="captcha_img" onclick="setCaptcha()" title="{:lang('change vercode')}" alt="captcha" style="max-width:120px;cursor:pointer;" />
								</div>
							</div>
						</div>
						<i style="font-size: 20px;color: red;font-weight: bold">* 绑定支付宝|微信 账号后可正常充值.
							</span><br/><br/>
						</i>
						<i style="font-size: 20px;color: red;font-weight: bold">* 请正确填写本人名下支付宝|微信 账号，非本人账户可能导致封号.
							</span><br/><br/>
						</i>
						<div class="fbottonlst" style="float: left;">
							<ul style="justify-content: left;min-width: 350px">
								<li class="on">
									<input type="button" class="fsubmit" lay-submit lay-filter="edit" style="float: left" value="提 交" >
								</li>
							</ul>
						</div>
					</li>
				</ul>
			</div>

		</div>
	</form>
	<div class="funaduibi fbai">
		<div class="fdbtable qmfdbtable ftable fboxbai">
			<table border="0" cellspacing="0" cellpadding="0" width="100%" id="dataTable">
			</table>
		</div>
	</div>
</div>
<script type="text/javascript">
	layui.use(['form','table'], function() {
		var form = layui.form,
				table = layui.table; //表格

		form.on('submit(edit)', function(data){
			var index = layer.load(1, {shade: [0.1, '#fff']});
			JsPost('{:url("user/changePay")}',
					{
						alipay_name:$("#alipay_name").val(),
						we_chat:$("#we_chat").val(),
						captcha:$("#captcha_ipt").val()
					},function (re) {
						layer.close(index);
						if(re.code >0){
							layer.msg(re.msg , {time:3500});
							window.location.href = "{:url('account')}";
						}else{
							setCaptcha();
							layer.msg(re.msg, {time:1500});
						}
					});
		});
	});

	//更改验证码图片
	setCaptcha = function() {
		$('#captcha_ipt').val("");
		var timestamp = new Date().getTime();
		$('#captcha_img').attr('src', '{:url(\'verify/index\')}?' + timestamp);
	}

</script>